'\" te
.\"  Copyright 1989 AT&T  Copyright (c) 2002 Sun Microsystems, Inc.  All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH ACCTSH 8 "Mar 15, 2002"
.SH NAME
acctsh, chargefee, ckpacct, dodisk, lastlogin, monacct, nulladm, prctmp,
prdaily, prtacct, shutacct, startup, turnacct \- shell procedures for
accounting
.SH SYNOPSIS
.LP
.nf
\fB/usr/lib/acct/chargefee\fR \fIlogin-name\fR \fInumber\fR
.fi

.LP
.nf
\fB/usr/lib/acct/ckpacct\fR [\fIblocks\fR]
.fi

.LP
.nf
\fB/usr/lib/acct/dodisk\fR [\fB-o\fR] [\fIfilename\fR]...
.fi

.LP
.nf
\fB/usr/lib/acct/lastlogin\fR
.fi

.LP
.nf
\fB/usr/lib/acct/monacct\fR \fInumber\fR
.fi

.LP
.nf
\fB/usr/lib/acct/nulladm\fR \fIfilename\fR...
.fi

.LP
.nf
\fB/usr/lib/acct/prctmp\fR \fIfilename\fR
.fi

.LP
.nf
\fB/usr/lib/acct/prdaily\fR [\fB-c\fR] [\fB-l\fR] [\fImmdd\fR]
.fi

.LP
.nf
\fB/usr/lib/acct/prtacct\fR \fIfilename\fR ['' \fIheading\fR '']
.fi

.LP
.nf
\fB/usr/lib/acct/shutacct\fR ['' \fIreason\fR '']
.fi

.LP
.nf
\fB/usr/lib/acct/startup\fR
.fi

.LP
.nf
\fB/usr/lib/acct/turnacct\fR on | off | switch
.fi

.SH DESCRIPTION
.SS "chargefee Command"
.sp
.LP
\fBchargefee\fR can be invoked to charge a \fInumber\fR of units to
\fIlogin-name\fR. A record is written to \fB/var/adm/fee\fR, to be merged with
other accounting records by \fBrunacct\fR(8).
.SS "ckpacct Command"
.sp
.LP
\fBckpacct\fR should be initiated using \fBcron\fR(8) to periodically check
the size of \fB/var/adm/pacct\fR. If the size exceeds \fIblocks\fR, \fB500\fR
by default, \fBturnacct\fR will be invoked with argument \fBswitch\fR. To avoid
a conflict with \fBturnacct switch\fR execution in \fBrunacct\fR, do not run
\fBckpacct\fR and \fBrunacct\fR simultaneously. If the number of free disk
blocks in the \fB/var\fR file system falls below  \fB500\fR, \fBckpacct\fR will
automatically turn off the collection of process accounting records via the
\fBoff\fR argument to \fBturnacct\fR. When at least  \fB500\fR blocks are
restored,  the accounting will be activated again on the next invocation of
\fBckpacct\fR. This feature is sensitive to the frequency at which
\fBckpacct\fR is executed, usually by the \fBcron\fR(8) command.
.SS "dodisk Command"
.sp
.LP
\fBdodisk\fR should be invoked by \fBcron\fR(8) to perform the disk accounting
functions.
.SS "lastlogin Command"
.sp
.LP
\fBlastlogin\fR is invoked by \fBrunacct\fR(8) to update
\fB/var/adm/acct/sum/loginlog\fR, which shows the last date on which each
person logged in.
.SS "monacct Command"
.sp
.LP
\fBmonacct\fR should be invoked once each month or each accounting period.
\fInumber\fR indicates which month or period it is. If \fInumber\fR is not
given, it defaults to the current month (01\(mi12). This default is useful if
\fBmonacct\fR is to executed using \fBcron\fR(8) on the first day of each
month. \fBmonacct\fR creates summary files in \fB/var/adm/acct/fiscal\fR and
restarts the summary files in \fB/var/adm/acct/sum\fR.
.SS "nulladm Command"
.sp
.LP
\fBnulladm\fR creates \fIfilename\fR with mode 664 and ensures that owner and
group are \fBadm\fR. It is called by various accounting shell procedures.
.SS "prctmp Command"
.sp
.LP
\fBprctmp\fR can be used to print the session record file (normally
\fB/var/adm/acct/nite/ctmp\fR created by \fBacctcon1\fR (see
\fBacctcon\fR(8)).
.SS "prdaily Command"
.sp
.LP
\fBprdaily\fR is invoked by \fBrunacct\fR(8) to format a report of the
previous day's accounting data. The report resides in
\fB/var/adm/acct/sum/rprt/mmdd\fR where \fImmdd\fR is the month and day of the
report. The current daily accounting reports may be printed by typing
\fBprdaily\fR. Previous days' accounting reports can be printed by using the
\fImmdd\fR option and specifying the exact report date desired.
.SS "prtacct Command"
.sp
.LP
\fBprtacct\fR can be used to format and print any total accounting
(\fBtacct\fR)file.
.SS "shutacct Command"
.sp
.LP
\fBshutacct\fR is invoked during a system shutdown to turn process accounting
off and append a  \fIreason\fR record to \fB/var/adm/wtmpx\fR.
.SS "startup Command"
.sp
.LP
\fBstartup\fR can be invoked when the system is brought to a multi-user state
to turn process accounting on.
.SS "turnacct Command"
.sp
.LP
\fBturnacct\fR is an interface to \fBaccton\fR (see \fBacct\fR(8)) to turn
process accounting \fBon\fR or \fBoff\fR. The \fBswitch\fR argument moves the
current \fB/var/adm/pacct\fR to the next free name in
\fB/var/adm/pacct.\fIincr\fR\fR (where \fIincr\fR is a number starting with
\fB0\fR and incrementing by one  for each additional \fBpacct\fR file), then
turns accounting back on again. This procedure is called by \fBckpacct\fR and
thus can be taken care of by the \fBcron\fR(8) command and used to keep \fB
pacct\fR to a reasonable size.   \fBshutacct\fR uses \fBturnacct\fR to stop
process accounting.   \fBstartup\fR uses \fBturnacct\fR to start process
accounting.
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.na
\fB\fB-c\fR\fR
.ad
.RS 6n
This option prints a report of exceptional resource usage by command, and may
be used on current day's accounting data only.
.RE

.sp
.ne 2
.na
\fB\fB-l\fR\fR
.ad
.RS 6n
This option prints a report of exceptional usage by login id for the specified
date. Previous daily reports are cleaned up and therefore inaccessible after
each invocation of \fBmonacct\fR.
.RE

.sp
.ne 2
.na
\fB\fB-o\fR\fR
.ad
.RS 6n
This option uses \fBacctdusg\fR (see \fBacct\fR(8)) to do a slower version of
disk accounting by login directory. \fIfilename\fRs specifies the one or more
filesystem names where disk accounting will be done.  If \fIfilename\fRs are
used, disk accounting will be done on these filesystems only. If the \fB-o\fR
option is used, \fIfilename\fRs should be mount points of mounted filesystems.
If the \fB-o\fR option is omitted, \fIfilename\fRs should be the special file
names of mountable filesystems.
.RE

.SH FILES
.sp
.ne 2
.na
\fB\fB/etc/logadm.conf\fR\fR
.ad
.RS 30n
Configuration file for the \fBlogadm\fR(8) command
.RE

.sp
.ne 2
.na
\fB\fB/usr/lib/acct\fR\fR
.ad
.RS 30n
Holds all accounting commands listed in section \fB8\fR of this manual
.RE

.sp
.ne 2
.na
\fB\fB/usr/lib/acct/ptecms.awk\fR\fR
.ad
.RS 30n
Contains the limits for exceptional usage by command name
.RE

.sp
.ne 2
.na
\fB\fB/usr/lib/acct/ptelus.awk\fR\fR
.ad
.RS 30n
Contains the limits for exceptional usage by login \fBID\fR
.RE

.sp
.ne 2
.na
\fB\fB/var/adm/acct/fiscal\fR\fR
.ad
.RS 30n
Fiscal reports directory
.RE

.sp
.ne 2
.na
\fB\fB/var/adm/acct/nite\fR\fR
.ad
.RS 30n
Working directory
.RE

.sp
.ne 2
.na
\fB\fB/var/adm/acct/sum\fR\fR
.ad
.RS 30n
Summary directory that contains information for \fBmonacct\fR
.RE

.sp
.ne 2
.na
\fB\fB/var/adm/acct/sum/loginlog\fR\fR
.ad
.RS 30n
File updated by last login
.RE

.sp
.ne 2
.na
\fB\fB/var/adm/fee\fR\fR
.ad
.RS 30n
Accumulator for fees
.RE

.sp
.ne 2
.na
\fB\fB/var/adm/pacct\fR\fR
.ad
.RS 30n
Current file for per-process accounting
.RE

.sp
.ne 2
.na
\fB\fB/var/adm/pacct\fR\fIincr\fR\fR
.ad
.RS 30n
Used if \fBpacct\fR gets large and during execution of daily accounting
procedure
.RE

.sp
.ne 2
.na
\fB\fB/var/adm/wtmpx\fR\fR
.ad
.RS 30n
History of user access and administration information
.RE

.SH SEE ALSO
.sp
.LP
.BR acctcom (1),
.BR acct (2),
.BR acct.h (3HEAD),
.BR utmpx (5),
.BR attributes (7),
.BR acct (8),
.BR acctcms (8),
.BR acctcon (8),
.BR acctmerg (8),
.BR acctprc (8),
.BR cron (8),
.BR fwtmp (8),
.BR logadm (8),
.BR runacct (8)
.SH NOTES
.sp
.LP
See \fBrunacct\fR(8) for the main daily accounting shell script, which
performs the accumulation of connect, process, fee, and disk accounting on a
daily basis. It also creates summaries of command usage.
